<script setup lang="ts">
import { onHide, onLaunch, onShow } from '@dcloudio/uni-app'

import { tabbarStore } from './tabbar/store'
import 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'
import { useSupabaseCoupleStore } from './store/supabaseCouple'

onLaunch(async (options) => {
  // 处理直接进入页面路由的情况：如h5直接输入路由、微信小程序分享后进入等
  // https://github.com/unibest-tech/unibest/issues/192
  console.log('App Launch', options)
  // 简化后的启动逻辑，不再需要路由拦截
  if (options?.path) {
    // 保留路径处理逻辑，但移除拦截器
    console.log('App launched with path:', options.path)
  }
  // 处理直接进入路由非首页时，tabbarIndex 不正确的问题
  tabbarStore.setAutoCurIdx(options.path)

  // --- Supabase 初始化 ---
  const coupleStore = useSupabaseCoupleStore()
  await coupleStore.initProfile()
})
onShow((options) => {
  console.log('App Show', options)
})
onHide(() => {
  console.log('App Hide')
})
</script>

<style lang="scss">
// 引入全局样式
@import '@/style/index.scss';

swiper,
scroll-view {
  flex: 1;
  height: 100%;
  overflow: hidden;
}

image {
  width: 100%;
  height: 100%;
  vertical-align: middle;
}

/* Hello Kitty 全局粉色主题 */
page {
  background: linear-gradient(135deg, #fff0f5 0%, #ffe4e1 100%);
}

/* 简化的全局按钮样式 */
button, .button, [class*="button"] {
  background: linear-gradient(135deg, #ff69b4, #ff1493) !important;
  border: none !important;
  color: white !important;
}

/* uni-app 原生按钮样式 */
.uni-btn {
  background: linear-gradient(135deg, #ff69b4, #ff1493) !important;
  border: none !important;
  color: white !important;
}


</style>
